#include <cstdio>

int main( )
{
    int f[ 31 ];
    int i, t, n;
    f[ 0 ] = 0;
    f[ 1 ] = 1;
    f[ 2 ] = 3;
    for ( i = 3; i <= 30; i++ )
        f[ i ] = f[ i - 1 ] + f[ i - 2 ] * 2;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d", &n);
        printf("%d\n", f[ n ]);
    }
    return 0;
}
